The present invention relates generally to the field of computer systems and, more particularly, to systems and methods for compiling source programs, particularly object-oriented ones, into system and application programs.
Before a digital computer may accomplish a desired task, it must receive an appropriate set of instructions. Executed by the computer's microprocessor, these instructions, collectively referred to as a "computer program," direct the operation of the computer. Expectedly, the computer must understand the instructions which it receives before it may undertake the specified activity.
Owing to their digital nature, computers essentially only understand "machine code," i.e., the low-level, minute instructions for performing specific tasks--the sequence of ones and zeros that are interpreted as specific instructions by the computer's microprocessor. Since machine language or machine code is the only language computers actually understand, all other programming languages represent ways of structuring human language so that humans can get computers to perform specific tasks.
While it is possible for humans to compose meaningful programs in machine code, practically all software development today employs one or more of the available programming languages. The most widely used programming languages are the "high-level" languages, such as C or Pascal. These languages allow data structures and algorithms to be expressed in a style of writing which is easily read and understood by fellow programmers.
A program called a "compiler" translates these instructions into the requisite machine language. In the context of this translation, the program which is written in the high-level language is called the "source code" or source program. The low-level or machine language, on the other hand, comprises "object code." Once created, object code (e.g., .obj file) is a separate program in its own right--it includes instructions which may be executed by the target microprocessor. In practice, however, the object code is usually first linked (i.e., combined) with other object code or libraries, which include standard routines.
Compilers are fundamental to modern computing. Translating human-oriented programming languages into computer-oriented machine languages, compilers allow computer programmers to ignore the machine-dependent details of machine language. Instead of focusing on the register set or memory architecture of a particular computer, for instance, one may simply concentrate on solving the problem at hand. Thus, high-level languages are "portable," that is, they afford a level of abstract which permits a single program to be implemented on several different machines, including ones of vastly different architecture.
Of particular interest to the present invention are compiler and development tools designed for graphic user interfaces (GUIs), such as Microsoft.RTM. Windows and Apple.RTM. Macintosh System 7. Employing an intuitive "desktop metaphor", including such familiar objects as file cabinets, folders, and trash cans, these system have largely displaced awkward command-line systems, such as MS-DOS.
While GUIs are easy for the users to use, they are by no means simple to program. Instead, the intuitive user interface belies an extremely complex system, one having hundreds of API (Application Programming Interface) calls. A simple "Hello World" Microsoft Windows program written in C, for example, requires a hundred or so lines of source code. Besides the sheer bulk of the API, however, the programmer faces an even greater challenge--that of understanding the intricacies of a message-driven environment.
At the heart of a GUI such as MS-Windows is a message or event-driven system, one which requires a shift in the way programmers normally think about computer programs. Traditionally, programmers have developed programs consisting of sequential procedures or modes. As such these programs have a well-defined beginning, middle, and end, with little or no flexibility for the user to vary this-pre-determined sequence.
A GUI, in contrast, promotes a "modeless" model, that is, one not tied to any particular predefined sequence of modes. To accomplish this, these systems introduce the notion of "events" and "messages." An event is any activity of interest, such as the press of key on a keyboard or movement of a pointing (mouse) device. The system responds to an event by sending a message to the currently executing application(s). In MS-Windows, for instance, when the user clicks a left mouse button, a WM.sub.-- LBUTTONDOWN message is sent. Similarly, pressing a keyboard key causes a WM.sub.-- KEYDOWN message to be sent. If the user selects an item from a menu, a WM.sub.-- COMMAND message is sent. Other messages correspond to manipulating scroll bars (WM.sub.-- HSCROLL, WM.sub.-- VSCROLL), resizing windows (WM.sub.-- SIZE), redrawing windows (WM.sub.-- PAINT), closing windows (WM.sub.-- CLOSE), and so on.
There are so many messages which may be generated in fact that managing them has become quite a chore in itself. Using C, for example, the programmer writes an event loop that checks to see whether there any messages which must be responded to. In practice, however, this entails writing a gargantuan case statement that dispatches messages to various functions. And in a Windows program of any complexity, this case statement often spans several pages, making development and maintenance of the program an exceedingly difficult task. Thus, there is much interest in devising tools which reduce or eliminate the complexity of GUI development.
Although not an object-oriented system itself, Windows possesses characteristics which facilitate application development with object-oriented programming (OOP) methodologies. Most notably, Windows is an event-driven or message-based system; its messages are analogous to the OOP concept of sending messages to objects. Combining the event-driven nature of Windows with an OOP language creates a single, more consistent development model. Just as a high-level language frees a programmer from the need to understand machine-level details, an OOP language, by hiding Windows details, eases the task of learning an event-driven architecture.
While the move from procedural to object-oriented programming has facilitated the creation and maintenance of GUI application software, present day development tools have not kept pace. More particularly, application development in an object-oriented programming language, such as C++, brings with it a host of new complexities which the application developer must somehow manage. For instance, a C++ program of even modest complexities requires the creation and maintenance of immense class hierarchies--sophisticated data structures with complex interdependencies. Thus, while a programmer may encapsulate the complexities of a GUI application in an object-oriented framework, the complexities of such a framework, in turn, must be managed with tools which are inadequate for object-oriented development.
What is needed are systems and methods for simplifying the creation and management of object-oriented applications, particularly those with complex class hierarchies. More particularly, such a system should provide the developer with the ability to easily manage the complex data structures attendant to object-oriented development. The present invention fulfills this and other needs.